package com.dg.cuckoo.core;

import org.springframework.web.bind.annotation.ExceptionHandler;

public class BaseController {
    /**
     * 操作成功的状态码
     */
    public static final int OK=20000;


    @ExceptionHandler(com.dg.cuckoo.core.ServiceException.class)
    public JsonResult<Void> handleException(Throwable e) {
        JsonResult<Void> jr = new JsonResult<>(e);

        if (e instanceof com.dg.cuckoo.core.ServiceException) {
            jr.setCode(4000);
        }
        return jr;
    }
}
